package org.nanhill.osgi.example.dao.ibatis;

import java.sql.SQLException;

import org.nanhill.osgi.example.dao.UserDao;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class IbatisUserDao extends SqlMapClientDaoSupport implements UserDao {
	

//	public IbatisUserDao() {
//		throw new RuntimeException();
//	}

	public boolean exist(String username, String password) {
		int count = 0;
		try {
			count = (Integer) getSqlMapClient().queryForObject(
					"user.countByNick", username);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return count > 0;
	}
}
